"use client"; import { useQuery } from "@tanstack/react-query"; import { Printer } from "lucide-react"; import { useParams } from "next/navigation"; import { BenchmarkTable, EquityVsBenchmarks, MetricsGrid, Provenance, StressTable, Underwater, WalkForward } from "@/components/run-views"; import { Badge, Button, Card, ErrorBox, KV, PageHeader, Spinner } from "@/components/ui"; import { api } from "@/lib/api"; import { fmtTs } from "@/lib/format"; import type { Run, StrategyMeta } from "@/lib/types"; export default function ReportPage() { const { id } = useParams<{ id: string }>(); const run = useQuery({ queryKey: ["run", id], queryFn: () => api(`/api/backtests/${id}`) }); const strategies = useQuery({ queryKey: ["strategies"], queryFn: () => api<{ items: StrategyMeta[] }>("/api/strategies") }); if (run.isLoading) return ; if (run.error) return ; const r = run.data!; const meta = strategies.data?.items.find((s) => s.name === r.strategy); const a = r.artifacts, m = r.metrics, p = r.provenance ?? {}; if (r.status !== "done" || !a || !m) return ; const w = p.window as [number, number] | undefined; return (
{r.symbol} · {r.interval_min}-minute bars · generated {new Date().toISOString().slice(0, 10)} · run {r.id}} actions={} />
{meta?.experimental && experimental — not validated for live trading}{meta?.family}{meta?.allows_short ? long/short : long-only spot}

{meta?.hypothesis ?? "—"}

{meta?.references?.length ?

References: {meta.references.join("; ")}

: null}
{a.holdout ? <>

Holdout from {fmtTs(a.holdout.start_ts)} — never used for parameter selection.

:

No holdout window was reserved for this run.

}
    {(meta?.failure_modes ?? []).map((f) =>
  • {f}
  • )}
  • History is accumulated from Kraken REST (≤720 bars per poll); coverage is limited to what has been collected since deployment unless a licensed dataset is loaded.
  • Fills are simulated: no real queue priority, and partial fills are approximated by a participation cap.
  • Results are not a claim of future profitability; experimental strategies must pass out-of-sample and paper-trading validation before live use.
); }